package api

import (
	"gitee.com/gcom/stockdock/core/job"
	"gitee.com/gcom/stockdock/core/router"
	s "gitee.com/gcom/stockdock/core/support"
	"net/http"
)

func init() {
	router.AdminRouter.HandleFunc("/list/updateSH", updateSh).Methods("GET")
	router.AdminRouter.HandleFunc("/list/updateSZ", updateSz).Methods("GET")
	router.ApiRouter.HandleFunc("/testJob", testJob).Methods("GET")
}

func testJob(w http.ResponseWriter, r *http.Request) {
	ctx := s.GetTracerCtx(w, r)
	job.JobTest.Run(ctx)
}

// 更新上海交易所股票列表
func updateSh(w http.ResponseWriter, r *http.Request) {
	ctx := s.GetTracerCtx(w, r)
	job.JobStockListSh.Run(ctx)
}

// 更新深圳交易所股票列表
func updateSz(w http.ResponseWriter, r *http.Request) {
	ctx := s.GetTracerCtx(w, r)
	job.JobStockListSz.Run(ctx)
}
